<template>
  <tbody>
      <tr v-for="(item,index) in goodsName">
          <td><input type="checkbox" :checked='item.isChecked' @click="singleCheck(index)"></td>
          <td>{{index + 1}}</td>
          <td>{{item.name}}</td>
          <td>{{item.price}}</td>
          <td>
            <button @click="handleReduce(index)" :disable="item.count === 1 ">-</button>
            {{item.count}}
            <button @click="handleAdd(index)">+</button>
          </td>
          <td>
            <button @click="handleRemove">移除</button>
          </td>
        </tr>
  </tbody>
</template>

<script>
    export default {
        name: "",
        props:["goodsName"],
        methods:{
          handleReduce:function (index) {
            this.$emit("a",index)
          },
          handleAdd:function (index) {
            this.$emit("b",index)
          },
          singleCheck:function (index) {
            this.$emit("e",index)
          },
          handleRemove:function () {
            this.$emit("c")
          }
        }
    }
</script>

<style scoped>

</style>
